package gov.nasa.anml.parsing;

import java.io.IOException;

import gov.nasa.anml.utility.SimpleString;
import org.antlr.runtime.*;

public class ANMLFileStream extends ANTLRFileStream implements ANMLCharStream {
	
	public ANMLFileStream(String fileName) throws IOException {
		super(fileName);
	}

	public ANMLFileStream(String fileName, String encoding) throws IOException {
		super(fileName, encoding);
	}
	
	public char[] getData() {
		return data;
	}
	
	public SimpleString makeSimpleString(int start, int stop) {
		return new SimpleString(data,start,stop+1);
	}

	@Override
	public void consume() {
        if ( p < n ) {
			if ( data[p]=='\n' ) {
				line++;
				charPositionInLine=0;
			} else if (data[p]=='\t') {
				charPositionInLine+=4;
			} else {
				charPositionInLine+=1;
			}
            p++;
        }
	}
	
	

}
